package lab1;

public class NString{
	
    private String str;    
    
    public NString (String theString){
        this.str = theString;
    }
    
    public String getString(){
    	return str;
    };
    
    public void setString(String theString){
    	this.str = theString;
    };
    
    public Boolean isPrefix(String theString){
    	if (str.length() <= theString.length())
    		return false;
    	for (int i = 0; i < theString.length(); i++)
    	{
    		if (str.charAt(i) != theString.charAt(i))
    			return false;
    	}
    	return true;
    };
    
    public Boolean isSuffix(String theString){
    	if (str.length() <= theString.length())
    		return false;
    	for (int i = theString.length() - 1, j = 0; i >= 0; i--, j++)
    	{
    		if (str.charAt(str.length() - 1 - j) != theString.charAt(i))
    			return false;
    	}
    	return true;    
    };
    
    public Boolean isSubstring(String theString){    	    
    	return str.contains(theString);
    };   
}
